It changes the current drawing color to blue.
Think of the Graphics
object as being like a sheet of paper,
some colored pens, and some drawing methods.
Use the following to set the color of the paper to white:
gr.setColor( Color.white ); gr.fillRect( 0, 0, width, height );
where
gr
is a reference to the Graphics
object.
Use the following method of the
Graphics
object to
change the pen color:
gr.setColor( Color.somecolor );
Several million colors are possible, but for now, use the pre-defined colors:
Color.red Color.orange Color.blue Color.magenta Color.gray Color.darkGray Color.yellow Color.green Color.white Color.black Color.lightGray Color.pink Color.cyan
These are static
values from
the class Color
.
(Look at the documentation under
Color
to see how to set other colors.)
What happened to purple?